package com.lzc.pojo.vo;

import com.lzc.enums.CodeType;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result<T> {

    private Integer code;

    private T data;

    private String message;

    public static <T> Result<T> OK(T data){
        return new Result<>(CodeType.SUCCESS.getCode(), data, null);
    }

    public static <T> Result<T> FILE(String message){
        return new Result<>(CodeType.FILE.getCode(), null, message);
    }

    public static <T> Result<T> result(CodeType codeType, T data, String message){
        return new Result<>(codeType.getCode(), data, message);
    }

}
